//
// Copyright (c) 2014, 保留所有权利。
//
// FixFollowRecordTotal.java
//
// 作    者：王红燕
// 当前版本：1.0
// 2015 下午6:08:44
//
// 
//
package com.vanke.agent.fix;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;

import com.vanke.agent.ADataSource;
import com.vanke.agent.common.Cache;

public class FixFollowRecordTotal {
	public static void main(String[] args) {
		Connection readCon = ADataSource.getConnection(ADataSource.SCHEMA_BIZ);
		Connection writeCon = ADataSource.getConnection(ADataSource.SCHEMA_BIZ);
		try {
			List<String> tables = Cache
					.loadTables(readCon, "cst_FollowRecord_");
			for (String table : tables) {
				updateTable(readCon, writeCon, table);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			ADataSource.close(readCon);
			ADataSource.close(writeCon);
		}
	}

	private static void updateTable(Connection readCon, Connection writeCon,
			String table) {
		updateTableBooking(readCon, writeCon, table);
		updateTableOrder(readCon, writeCon, table);
		updateTableContract(readCon, writeCon, table);
		updateTableGetin(readCon, writeCon, table);
	}

	private static void updateTableBooking(Connection readCon,
			Connection writeCon, String table) {
		PreparedStatement queryPstmt = null;
		ResultSet queryRs = null;

		PreparedStatement updatePstmt = null;
		try {

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			ADataSource.close(queryRs, queryPstmt, null);
			ADataSource.close(updatePstmt);
		}
	}

	private static void updateTableOrder(Connection readCon,
			Connection writeCon, String table) {
		PreparedStatement queryPstmt = null;
		ResultSet queryRs = null;

		PreparedStatement updatePstmt = null;
		try {
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			ADataSource.close(queryRs, queryPstmt, null);
			ADataSource.close(updatePstmt);
		}
	}

	private static void updateTableContract(Connection readCon,
			Connection writeCon, String table) {
		PreparedStatement queryPstmt = null;
		ResultSet queryRs = null;

		PreparedStatement updatePstmt = null;
		try {

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			ADataSource.close(queryRs, queryPstmt, null);
			ADataSource.close(updatePstmt);
		}
	}

	private static void updateTableGetin(Connection readCon,
			Connection writeCon, String table) {
		PreparedStatement queryPstmt = null;
		ResultSet queryRs = null;

		PreparedStatement updatePstmt = null;
		try {

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			ADataSource.close(queryRs, queryPstmt, null);
			ADataSource.close(updatePstmt);
		}
	}

}
